public class VM_Client{

  private enum Option { SEND, REFRESH, DELETE, ERROR };
  
  static public void main( String args[] ) {
    
    String host = "host-vm";

    // Es determina quin metode es vol invocar
    Option op = Option.ERROR;
    if(args.length > 0) {
      if(args[0].equals("send") && args.length==5)      
	op = Option.SEND;
      else if(args[0].equals("refresh") && args.length==1) 
	op = Option.REFRESH;
      else if(args[0].equals("delete") && args.length==2)
	op = Option.DELETE;
    }
    switch (op){
      case SEND:
	new VM_Client_Send( host, 4444, args[1], args[2], args[3], args[4] );
      break;
      case REFRESH:
	new VM_Client_Refresh( host, 5555 );
      break;
      case DELETE:
	new VM_Client_Delete(args[1]);
      break;
      case ERROR:
	printUsage();  
      break;
      default:
    }

  }

  private static void printUsage(){
    System.out.println("Opció incorrecte.");
    System.out.println("Sintaxi d'us: java Client_VM [ send | refresh | delete ]");
    System.out.println("send:          send idExperiment usuari empresa dadesPath");
    System.out.println("refresh:       refresh");
    System.out.println("delete:        delete idExperiment");
    return;
  }

}